Skip to main content

Sugar - Touch module

Features


SignalDigital output
1(high level): touch module is pressed
0(low level): touch module is not pressed

Module Principle

The module contains a built-in touch detection chip that touches the housing via a spring, implementing the touch effect of a finger in close proximity

Wiring

Future Board Lite Main Board 3 - Copy.png

Future Board Lite InterfaceCable
Sugar Touch Module.pngSugar Touch ModulePort3White PH2.0-3Pin Interface Cableuntitled.100.png

warning

Can be connected to Port1, Port2, Port3, Port4

When programming, make sure the interface is consistent with the actual one.

Blocks - Function Description

No.Block ImageBlock Function
1image-20240316164804837Detect whether the touch sensor is pressed

Program-Full program

image-20240316165316144

Program - Function Description

tip
  1. Set the color screen to dot matrix mode
  2. Initialize the variable, which is responsible for recording the number of times the touch sensor is pressed
  3. Loop detection
  4. When the touch sensor is detected as being pressed
  5. Display a smiling face image once, increase X, and then display X on the dot matrix screen
  6. When the touch sensor is not detected as being pressed, the dot matrix screen displays a crying face

Use Kittenblock

Run the program offline to see the effect

Using Robotbit on Microbit

Robotbit_compressed.png

Programming Platform

Microsoft MakeCode for micro:bit

Programming with Makecode Platform

Add Sugar Plugin

image-20240311154521941 image.png

Search for Sugar in extensions, click Add

Circuit Connection

image.png

Microbit InterfaceWire
Sugar Touch Module.pngSugar Touch ModuleP0White PH2.0-3Pin Interface Wireuntitled.100.png

warning

Support connecting to P0, P1, P13, etc. When programming, pay attention to keep the interface consistent with the actual.

Blocks - Function Description

No.Block ImageBlock Function
1image-20240316165538686Read whether the touch module is touched

Case: Touch Detection

image-20240316165605676